package org.freespace.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.freespace.model.JobMachine;
import org.freespace.mapper.JobMachineMapper;
import org.freespace.service.IJobMachineService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 作业与压测机器关联表 服务实现类
 * </p>
 *
 * @author liuqi
 * @since 2023-05-08
 */
@Service("jobMachineService")
public class JobMachineServiceImpl extends ServiceImpl<JobMachineMapper, JobMachine> implements IJobMachineService {

    @Override
    public int getMachineNum(Integer jobId) {
        LambdaQueryWrapper<JobMachine> wrapper = Wrappers.<JobMachine>lambdaQuery().eq(JobMachine::getJobId, jobId);
        return list(wrapper).size();
    }
}
